def l704(nums,target):
    left = 0
    right = len(nums)-1
    # 0<a<=6
    mid = right//2
    while left <= right:
        if nums[mid] == target:return mid
        if nums[mid] > target:
            right = mid -1 #因为nums[mid-1]在范围内，nums[mid]不在范围内
        else:
            left = mid + 1
        mid = (right -left)//2+left
    return -1
    pass

if __name__ =='__main__':
    #l704([-1,0,3,5,9,12],2)
    l704([2,5],5)
    pass